﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Entity.CommonEnums;

namespace System.Web.Mvc.Html
{
    /// <summary>
    /// Html标签扩展方法
    /// </summary>
    public static class HtmlExtensions
    {
        static int _UserOperatorRole = 31;
        public static MvcHtmlString ActionLink(this HtmlHelper htmlHelper, string linkText, string fun, UserOperatorRole userOperatorRole)
        {
            if (((UserOperatorRole)_UserOperatorRole & userOperatorRole) != 0)
            {
                return MvcHtmlString.Create("<a class='button' href='javascript:void(0)' onclick='" + fun + ";return false;' title='" + linkText + "'>" + linkText + "</a>");
            }

            else
                return null;
        }

        public static MvcHtmlString ActionLink(this HtmlHelper htmlHelper, string linkText, string actionName, UserOperatorRole userOperatorRole)
        {
            if (((UserOperatorRole)_UserOperatorRole & userOperatorRole) == 0)
                return null;
            else
                return htmlHelper.ActionLink(linkText, actionName, null, new { @class = "button" });
        }
    }


}